package com.wiscamp.ninechapters.problems.domain.models.problems.answers;


import com.wiscamp.ninechapters.problems.enums.AnswerTypes;
import com.wiscamp.ninechapters.problems.math.LatexDecimal;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 概率答案
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class ProbabilityAnswer extends Answer {
    /**
     * 答案值
     */
    private LatexDecimal value;

    public ProbabilityAnswer(long answerId, long questionId, int answerIndex, int groupIndex, LatexDecimal value) {
        setAnswerType(AnswerTypes.PROBABILITY);
        this.value = value;
        setAnswerId(answerId);
        setQuestionId(questionId);
        setAnswerIndex(answerIndex);
        setGroupIndex(groupIndex);
        setAnswerTypeId(this.getAnswerType().getValue());
    }

    @Override
    public String getAnswerText() {
        return value.getLatex();
    }
}
